package com.beauty.dressing.module.community.holder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.beauty.dressing.R;
import com.beauty.dressing.common.base.BaseRecyclerViewHolder;
import com.beauty.dressing.common.bean.Ad;
import com.beauty.dressing.common.bean.BaseBean;
import com.beauty.dressing.module.common.view.BannerLayout;
import com.beauty.dressing.module.main.activity.PostSearchActivity;

import java.util.ArrayList;
import java.util.List;

public class CommunityHeaderHolder extends BaseRecyclerViewHolder<BaseBean> {
    private BannerLayout mBannerLayout;
//    private ImageView mSearch;
    public CommunityHeaderHolder( Context context, LayoutInflater inflater, ViewGroup viewGroup) {
        super(R.layout.community_top_header, context, inflater, viewGroup);
    }

    @Override
    public void findView() {
        mBannerLayout = itemView.findViewById(R.id.banner_layout);
        mBannerLayout.adjustHeight(0.33f);
//        mSearch = itemView.findViewById(R.id.search_img);

    }

    @Override
    public void bindData(BaseBean bean, int position) {
//        mSearch.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                PostSearchActivity.startActivity(mContext,4);
//            }
//        });
        List<Ad> adList = new ArrayList<>();
        adList.add(new Ad("https://tvax2.sinaimg.cn/crop.0.0.664.664.180/006zWmitly8fgxj1jcsevj30ig0igt9h.jpg",null));
        adList.add(new Ad("http://images.9zhitx.com/ac870ecd-26f4-4670-9364-8a542b4e322a.jpg",null));
        adList.add(new Ad("https://tvax2.sinaimg.cn/crop.0.0.664.664.180/006zWmitly8fgxj1jcsevj30ig0igt9h.jpg",null));
        mBannerLayout.setBannerPagerAdapter(adList,true);
    }
}
